package com.chezai.client.presenter;

import android.content.Context;

import com.chezai.client.inter.IMvpView;

/**
 * Created by likunyang on 2017/8/24.
 */

public class BasePresenter<V extends IMvpView> implements IPresenter<V> {
    protected String TAG = this.getClass().getSimpleName();
    public V mvpView;
    public Context mContext;

    /**
     * Presenter与View建立连接
     *
     * @param mvpView 与此Presenter相对应的View
     */


    @Override
    public void attachView(V mvpView) {
        this.mvpView = mvpView;
    }

    /**
     * Presenter与View连接断开
     */
    @Override
    public void detachView() {
        this.mvpView = null;
    }

    /**
     * 是否与View建立连接
     *
     * @return
     */
    public boolean isViewAttached() {
        return mvpView != null;
    }

    /**
     * 获取当前连接的View
     *
     * @return
     */
    public V getMvpView() {
        return mvpView;
    }

    @Override
    public void onStart() {

    }

    @Override
    public void onResume() {

    }

    @Override
    public void onPause() {

    }

    @Override
    public void onStop() {

    }

    @Override
    public void onDestroy() {

    }

    @Override
    public void setContext(Context context) {
        this.mContext = context;
    }
}
